home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / ACORNUSERS / CBSA / COMPUTER / POKEID / KaDataMan < prev    next >
Text File  |  1998-05-31  |  66KB  |  2,422 lines

  1. Kasoft Software
  2.  
  3.  
  4. KaData Programmer's Manual
  5. (Prepress Edition)
  6.  
  7.  
  8. Copyright © Kasoft Software 1993,1996,1997
  9.  
  10. Neither the whole nor any part of this manual, or the software described herein may be adapted or reproduced in any material form except with the prior written approval of the author.
  11.  
  12. The software described in this manual is subject to continuous development and improvement. All information of a technical nature and particulars of the software and its use (including the information and particulars in this manual) are given by Kasoft Software in good faith. However, Kasoft Software will not accept liability for any loss or damage arising from the use of the software or the documentation in this manual.
  13.  
  14. Suggestions for future versions of the software and this manual are welcomed. All correspondence should be addressed to:
  15.  
  16. Kade Hansson
  17. Kasoft Software
  18. 4/73 Alexander Street
  19. Shearwater 7307
  20. AUSTRALIA
  21.  
  22. Telephone (International): [61] 3 64287448
  23. Telephone (Australia): (03) 64287448
  24. e-mail: kade_fh@postoffice.utas.edu.au
  25.  
  26. The relocatable module 'KaData' was programmed by Kade Hansson. This module is suitable for use with all ARM-based computers running Acorn RISC OS version 2.00 or later. This extract is from the third issue of the prepress edition of this manual. It documents version 0.51 (08 Dec 1997).
  27.  
  28. This extract or the software it documents has no connection with Acorn Computers Limited, but necessary registration of the module title and allocation of a software interrupt chunk number has been carried out. Thus, the software should not interfere with other software which has taken similar precautions.
  29.  
  30. KASOFT is a trademark of Kasoft Software, and owned by Kade Hansson.
  31.  
  32. ACORN is a trademark of Acorn Computers Limited.
  33.  
  34. Prepress Edition (ASCII text file version)
  35. Published May 1998; Issue 5
  36. Written by Kade Hansson
  37. Printed version published by Kasoft Typesetting
  38. Code KM09601,00E
  39.  
  40.  
  41. _____________________
  42.  
  43. KaData Support Module
  44. _____________________
  45.  
  46.  
  47. The KaData support module was initially developed by Kasoft to provide a comprehensive programmer's toolkit for use with the KaData Database Management System. It will eventually implement utility operations for the Obmat file format, which is (or will be) used by FiletypeExtend, FileWrapHandler, FileBox, KaData, and the KaProdesy Program Definition System.
  48.  
  49. The module provides many general-purpose utility routines for maipulating blocks of data in memory, including:
  50.  
  51. -    block copy
  52. -    block fill
  53. -    byte search (including a routine to traverse delimited data)
  54. -    word search
  55. -    string search (including provision for simple case insensitivity)
  56. -    wildcarded search (providing for proper accent and case insenstivity)
  57.  
  58. Some of the simple search routines (for bytes, words and strings) were written with optimum performance on the ARM2 architecture in mind, with mild employment of "loop unrolling" increasing code length by up to a factor of 4. In future, these may be supplemented by specialized routines which are automatically substituted according to the capabilities of the processor in use. The software is believed to be StrongARM compatible, although we have no capability to test software with this processor yet.
  59.  
  60. Also included in the module are utility functions for more specific purposes. These include functions to:
  61.  
  62. -    assemble an ARM instruction from specified parameters
  63.     (useful in a compiler back-end*),
  64. -    perform efficient searches in a variety of data structures,
  65. -    aid in the construction of filing systems & Filer-like applications
  66.     (with routines for wildcarded matching, leafname validation etc.),
  67. -    access the KaData general-purpose module format
  68.     (for generating RISC OS menus among other things),
  69. -    maintain multiple shifting heaps
  70.     (with full control over each allocated block),
  71. -    read and write arbitrarily terminated strings to files, and
  72. -    control a timer based on IOC Timer 1.
  73.  
  74. * This routine was used in the KaModula2Library module, but that module (which was never released) has been renamed to KaProdesy, and all KaModula2 SWI definitions have been revoked in order that a new set may be placed in that chunk (&48300, Acorn registered).
  75.  
  76. In combination with our AddressDevice DA product, in-house versions of the KaData module provide support for the full 32-bit address space possible on newer ARM architectures. However the relevant entry points are currently disabled, due to the lack of testing done. The special entry points allow ARM6 and later architectures to run routines in the full 32-bit address space. Previously, this had not been possible under RISC OS, as it uses 26-bit PC ARM processor modes for backwards compatibility.
  77.  
  78. The advantages of using 32-bit address space are significant. Specially designed modules can be placed in dynamic areas, eliminating the need for a fragmented relocatable module area. Also, it is possible to implement virtual memory for programs running in 32-bit space.
  79.  
  80. This module was written by Kasoft Software and it is subject to continuous development and improvement. Updates to new versions and licences for distributing this module with commercial software are available. Feel free to contact us at the address given on the release note. Criticisms and suggestions for improvement will be appreciated. Please note that copyright subsists in this software and it may not be freely distributed unless written permission has been given by us.*
  81.  
  82. * Excepting versions up to 0.99, which are public domain releases with possibly limited functionality.
  83.  
  84.  
  85. _________________
  86.  
  87. Technical Details
  88. _________________
  89.  
  90.  
  91. Errors
  92.  
  93. The errors generated by the KaData support module are described here. The SWI chunk number (&482C0) should be added to the error numbers given here to get the full error number.
  94.  
  95. SWI not implemented
  96.  
  97. KaData support error number 0. This error indicates that the SWI called has no entry point defined in the instantiated version of the module.
  98.  
  99. Obmat file header is corrupted
  100.  
  101. KaData support error number 1. This error usually indicates that an Obmat file's header has become corrupted. Also generated by other Obmat-aware software which is not able to read multi-chunk, big endian, or non-base 32 Obmats, in which case the error message may vary. If this error is generated by KaData_ObmatOp 0 (verify file integrity), then you can be sure that the header is actually corrupted.
  102.  
  103. Obmat file is corrupted: missing expected marker
  104.  
  105. KaData support error number 2. This error usually indicates that an Obmat file has become corrupted, as it does not have a marker where one is expected. Also generated by other Obmat-aware software which is confused by an Obmat structure more complex than it can deal with. If this error is generated by KaData_ObmatOp 0 (verify file integrity), then you can be sure that the file is actually corrupted.
  106.  
  107. Cannot search for null string
  108.  
  109. KaData support error number 3. This error occurs when an attempt is made to search a block of memory for a null string.
  110.  
  111. Cannot enter module: outside 26-bit space
  112.  
  113. KaData support error number 4. An attempt has been made to start executing a module in 32-bit space. This cannot be reasonably implemented at this time.
  114.  
  115. TabModule cannot initialize: nil actual module pointer
  116.  
  117. KaData support error number 6. An attempt has been made to initialize a malformed TabModule. The address of the actual module has not been specified as required.
  118.  
  119. Bad KaData_SpecificSearch reason code
  120.  
  121. KaData support error number 7. This error arises when an invalid reason code is passed to KaData_SpecificSearch (SWI &482C7). Valid reason codes currently lie in the range 0-1.
  122.  
  123. Bad KaData_Filer reason code
  124.  
  125. KaData support error number 8. This error arises when an invalid reason code is passed to KaData_Filer (SWI &482C8). Valid reason codes currently lie in the range 0-2.
  126.  
  127. KaData is in use
  128.  
  129. KaData support error number 13. This error occurs when an attempt is made to kill or reinitialize the KaData module after its address in the RMA address space has been anchored by one or more calls to KaData_GetEntryPoints -3 (SWI &482CD). The module cannot successfully finalize until it has been released with a matching number of calls to KaData_GetEntryPoints -4. The current number of users of the support module is recorded in the system variable KaData$ModuleAnchor. The module will die if this variable is unset, but this should be taken as a last resort only, as programs may still be calling the entry points.
  130.  
  131. Required Territory character table not found
  132.  
  133. KaData support error number 24. This error occurs when the TerritoryManager module fails to return a character table for the configured territory. A common cause is that the TerritoryManager module is not present (e.g. in RISC OS 2).
  134.  
  135. Bad KaData_Module reason code
  136.  
  137. KaData support error number 27. This error arises when an invalid reason code is passed to KaData_Module (SWI &482DB). Valid reason codes currently lie in the range 0-1.
  138.  
  139. Invalid address: translation to offset failed
  140.  
  141. KaData support error number 62. This error occurs when an attempt is made to assemble an instruction with an address that cannot be successfully embedded in an ARM instruction as a PC-relative offset.
  142.  
  143. Invalid immediate constant
  144.  
  145. KaData support error number 63. This error occurs when an attempt is made to assemble an instruction with an immediate constant that cannot be successfully embedded in an ARM instruction.
  146.  
  147.  
  148. _________
  149.  
  150. SWI Calls
  151. _________
  152.  
  153.  
  154. Index to KaData SWIs
  155.  
  156. Number    Name
  157.   482C0 KaData_MoveBytes
  158.   482C1 KaData_SearchByte
  159.   482C2 KaData_SearchWord
  160.   482C3 KaData_SearchString
  161.   482C4 KaData_SearchAlpha
  162.   482C5 KaData_SearchWildString
  163.   482C6 KaData_SearchWildAlpha
  164.   482C7 KaData_SpecificSearch
  165.  
  166.   482C8 KaData_Filer
  167.   482C9 KaData_FillBytes
  168.   482CA KaData_ReadInteger
  169.   482CB KaData_WriteInteger
  170.   482CC KaData_CountBytes
  171.   482CD KaData_GetEntryPoints
  172.   482CE    KaData_CallSupervisor32
  173.   482CF    KaData_ChangeHardwareVector32
  174.  
  175.   482D0    KaData_OSModule
  176.   482D1    KaData_Assemble
  177.   482D2    KaData_MetronomicTimerOn
  178.   482D3    KaData_MetronomicTimerOff
  179.   482D4    KaData_MetronomicTimerSmash
  180.   482D5    KaData_ReadMetronomicTimer
  181.   482D6    KaData_PokeDynamicArea
  182.   482D7    KaData_ObmatOp
  183.  
  184.   482D8 KaData_MatchWild
  185.   482D9    KaData_CopyString
  186.   482DA    KaData_Heap
  187.   482DB    KaData_Module
  188.   482DC    KaData_GetString
  189.   482DD KaData_PutString
  190.   482DE    KaData_SetMetronomicTimerQuantum
  191.  
  192.  
  193. KaData_MoveBytes
  194. (SWI &482C0)
  195.     Copy a block of memory to a new address
  196.  
  197. On entry
  198.  
  199. R1 = source address
  200. R2 = destination address
  201. R3 = length
  202.  
  203. On exit
  204.  
  205. R0-R3 corrupted
  206.  
  207. Interrupts
  208.  
  209. Interrupt status is not altered
  210. Fast interrupts are enabled
  211.  
  212. Processor mode
  213.  
  214. Processor is in SVC mode
  215.  
  216. Re-entrancy
  217.  
  218. SWI is re-entrant
  219.  
  220. Use
  221.  
  222. This is a fast memory copy routine, modelled on the one given by Acorn in the chapter on Filing Systems in the Programmers Reference Manual (RISC OS 2, p. 1000). It copies any number of bytes (>0) from the source address to the destination address.
  223.  
  224. Related SWIs
  225.  
  226. KaData_FillBytes (SWI &482C9)
  227.  
  228. Related vectors
  229.  
  230. None
  231.  
  232.  
  233. KaData_SearchByte
  234. (SWI &482C1)
  235.     Search for a given byte in a block of memory
  236.  
  237. On entry
  238.  
  239. R0 = byte to search for
  240. R1 = start address
  241. R2 = block for list of matching addresses
  242. R3 = length of block to be searched
  243. R4 = maximum size of matching address list (R4 < 4 means no list)
  244.  
  245. On exit
  246.  
  247. R0 preserved
  248. R1 = address of byte where search would resume
  249. R2 = block of matching addresses
  250. R3 = number of bytes left to be searched (0 means search complete)
  251. R4 preserved
  252. R5 = number of matches before address in R1 (0 means not found)
  253. R6 = address of last match (if R5 > 0, else preserved)
  254.  
  255. Interrupts
  256.  
  257. Interrupt status is not altered
  258. Fast interrupts are enabled
  259.  
  260. Processor mode
  261.  
  262. Processor is in SVC mode
  263.  
  264. Re-entrancy
  265.  
  266. SWI is re-entrant
  267.  
  268. Use
  269.  
  270. This is a fast byte search routine. In simple use, without a buffer, it can find the first instance of a byte in a designated block of memory.
  271.  
  272. If a matching address list block is specified, on exit it is updated with addresses of matching bytes. If the buffer was filled before the search could be completed, the call can be repeated to obtain subsequent lists of matches.
  273.  
  274. N.B. If the matching address list was filled up, R6 contains the match which would not fit in the list. The number of matches (returned in R5) includes this one.
  275.  
  276. Related SWIs
  277.  
  278. KaData_SearchWord (SWI &482C2), KaData_SearchString (SWI &482C3),
  279. KaData_SearchAlpha (SWI &482C4)
  280.  
  281. Related vectors
  282.  
  283. None
  284.  
  285.  
  286. KaData_SearchWord
  287. (SWI &482C2)
  288.     Search for a given 32-bit word in a block of memory
  289.  
  290. On entry
  291.  
  292. R0 = word to search for
  293. R1 = start address (word aligned)
  294. R2 = block for list of matching addresses
  295. R3 = length of block to be searched (multiple of 4)
  296. R4 = maximum size of matching address list (R4 < 4 means no list)
  297.  
  298. On exit
  299.  
  300. R0 preserved
  301. R1 = address of word where search would resume
  302. R2 = block of matching addresses
  303. R3 = number of bytes left to be searched (0 means search complete)
  304. R4 preserved
  305. R5 = number of matches before address in R1 (0 means not found)
  306. R6 = address of last match (if R5 > 0, else preserved)
  307.  
  308. Interrupts
  309.  
  310. Interrupt status is not altered
  311. Fast interrupts are enabled
  312.  
  313. Processor mode
  314.  
  315. Processor is in SVC mode
  316.  
  317. Re-entrancy
  318.  
  319. SWI is re-entrant
  320.  
  321. Use
  322.  
  323. This is a fast 32-bit word search routine. In simple use, without a buffer, it can find the first instance of a word in a designated block of memory.
  324.  
  325. If a matching address list block is specified, on exit it is updated with addresses of matching words. If the buffer was filled before the search could be completed, the call can be repeated to obtain subsequent lists of matches.
  326.  
  327. N.B. If the matching address list was filled up, R6 contains the match which would not fit in the list. The number of matches (returned in R5) includes this one.
  328.  
  329. Related SWIs
  330.  
  331. KaData_SearchByte (SWI &482C1)
  332.  
  333. Related vectors
  334.  
  335. None
  336.  
  337.  
  338. KaData_SearchString
  339. (SWI &482C3)
  340.     Search for a string of bytes in a block of memory (case sensitive)
  341.  
  342. On entry
  343.  
  344. R0 = pointer to search string (null terminated)
  345. R1 = start address
  346. R2 = block for list of matching addresses
  347. R3 = length of block to be searched
  348. R4 = maximum size of matching address list (R4 < 4 means no list)
  349.  
  350. On exit
  351.  
  352. R0 preserved
  353. R1 = address of byte where search would resume
  354. R2 = block of matching addresses
  355. R3 = number of bytes left to be searched (0 means search complete)
  356. R4 preserved
  357. R5 = number of matches before address in R1 (0 means not found)
  358. R6 = address of last character which matched the first in search string
  359.     (if R5 > 0, else preserved)
  360.  
  361. Interrupts
  362.  
  363. Interrupt status is not altered
  364. Fast interrupts are enabled
  365.  
  366. Processor mode
  367.  
  368. Processor is in SVC mode
  369.  
  370. Re-entrancy
  371.  
  372. SWI is re-entrant
  373.  
  374. Use
  375.  
  376. This is a fast string search routine. In simple use, without a buffer, it can find the first instance of a string in a designated block of memory.
  377.  
  378. If a matching address list block is specified, on exit it is updated with addresses of matching strings. If the buffer was filled before the search could be completed, the call can be repeated to obtain subsequent lists of matches.
  379.  
  380. N.B. If the matching address list was filled up, R6 contains the match which would not fit in the list. The number of matches (returned in R5) includes this one.
  381.  
  382. Related SWIs
  383.  
  384. KaData_SearchByte (SWI &482C1), KaData_SearchAlpha (SWI &482C4)
  385.  
  386. Related vectors
  387.  
  388. None
  389.  
  390.  
  391. KaData_SearchAlpha
  392. (SWI &482C4)
  393.     Search for a string of bytes in a block of memory (case insensitive)
  394.  
  395. On entry
  396.  
  397. R0 = pointer to search string (null terminated)
  398. R1 = start address
  399. R2 = block for list of matching addresses
  400. R3 = length of block to be searched
  401. R4 = maximum size of matching address list (R4 < 4 means no list)
  402.  
  403. On exit
  404.  
  405. R0 preserved
  406. R1 = address of byte where search would resume
  407. R2 = block of matching addresses
  408. R3 = number of bytes left to be searched (0 means search complete)
  409. R4 preserved
  410. R5 = number of matches before address in R1 (0 means not found)
  411. R6 = address of last character which matched the first in search string
  412.     (if R5 > 0, else preserved)
  413.  
  414. Interrupts
  415.  
  416. Interrupt status is not altered
  417. Fast interrupts are enabled
  418.  
  419. Processor mode
  420.  
  421. Processor is in SVC mode
  422.  
  423. Re-entrancy
  424.  
  425. SWI is re-entrant
  426.  
  427. Use
  428.  
  429. This is a fast string search routine where the byte comparisons are insensitive to case for characters in the ASCII range 32-127. In simple use, without a buffer, it can find the first instance of a string in a designated block of memory.
  430.  
  431. If a matching address list block is specified, on exit it is updated with addresses of matching strings. If the buffer was filled before the search could be completed, the call can be repeated to obtain subsequent lists of matches.
  432.  
  433. N.B. If the matching address list was filled up, R6 contains the match which would not fit in the list. The number of matches (returned in R5) includes this one.
  434.  
  435. Related SWIs
  436.  
  437. KaData_SearchByte (SWI &482C1), KaData_SearchString (SWI &482C3)
  438.  
  439. Related vectors
  440.  
  441. None
  442.  
  443.  
  444. KaData_SearchWildString
  445. (SWI &482C5)
  446.     Search for a wildcarded string of characters in a block of memory
  447.     (case sensitive)
  448.  
  449. On entry
  450.  
  451. R0 = pointer to wildcarded search string
  452. R1 = start address
  453. R2 = block for list of matching addresses
  454. R3 = length of block to be searched
  455. R4 = maximum size of matching address list (R4 < 4 means no list)
  456. R5 = single (one) character wildcard
  457. R6 = multiple (zero or more) character wildcard
  458. R7 = multiple wildcard exclusion character
  459.  
  460. On exit
  461.  
  462. R0 preserved
  463. R1 = address of byte where search would resume
  464. R2 preserved
  465. R3 = number of bytes left to be searched (0 means search complete)
  466. R4 preserved
  467. R5 = number of matches before address in R1 (0 means not found)
  468. R6 = address of last match (if R5 > 0, else corrupted)
  469. R7 preserved
  470.  
  471. Interrupts
  472.  
  473. Interrupt status is not altered
  474. Fast interrupts are enabled
  475.  
  476. Processor mode
  477.  
  478. Processor is in SVC mode
  479.  
  480. Re-entrancy
  481.  
  482. SWI is re-entrant
  483.  
  484. Use
  485.  
  486. This is a fast wildcarded string search routine. In simple use, without a buffer, it can find the first instance of a wildcarded string in a designated block of memory.
  487.  
  488. The wildcard characters used need to be specified, and a character which cannot form a part of a string matching the multiple wildcard should also be given. The exclusion character defines this routine to be a search through delimited character data, where the exclusion character is part of the delimiter.
  489.  
  490. If a matching address list block is specified, on exit it is updated with addresses of matching strings. If the buffer was filled before the search could be completed, the call can be repeated to obtain subsequent lists of matches.
  491.  
  492. N.B. If the matching address list was filled up, R6 contains the match which would not fit in the list. The number of matches (returned in R5) includes this one.
  493.  
  494. Related SWIs
  495.  
  496. KaData_SearchString (SWI &482C3), KaData_SearchWildAlpha (SWI &482C6),
  497. KaData_SpecificSearch (SWI &482C7), KaData_MatchWild (SWI &482D8)
  498.  
  499. Related vectors
  500.  
  501. None
  502.  
  503.  
  504. KaData_SearchWildAlpha
  505. (SWI &482C6)
  506.     Search for a wildcarded string of characters in a block of memory
  507.     (case insensitive)
  508.  
  509. On entry
  510.  
  511. R0 = pointer to wildcarded search string
  512. R1 = start address
  513. R2 = block for list of matching addresses
  514. R3 = length of block to be searched
  515. R4 = maximum size of matching address list (R4 < 4 means no list)
  516. R5 = single (one) character wildcard
  517. R6 = multiple (zero or more) character wildcard
  518. R7 = multiple wildcard exclusion character
  519.  
  520. On exit
  521.  
  522. R0 preserved
  523. R1 = address of byte where search would resume
  524. R2 preserved
  525. R3 = number of bytes left to be searched (0 means search complete)
  526. R4 preserved
  527. R5 = number of matches before address in R1 (0 means not found)
  528. R6 = address of last match (if R5 > 0, else corrupted)
  529. R7 preserved
  530.  
  531. Interrupts
  532.  
  533. Interrupt status is not altered
  534. Fast interrupts are enabled
  535.  
  536. Processor mode
  537.  
  538. Processor is in SVC mode
  539.  
  540. Re-entrancy
  541.  
  542. SWI is re-entrant
  543.  
  544. Use
  545.  
  546. This is a fast wildcarded string search routine where the character comparisons are insensitive to case as defined by the current territory. In simple use, without a buffer, it can find the first instance of a wildcarded string in a designated block of memory.
  547.  
  548. The wildcard characters used need to be specified, and a character which cannot form a part of a string matching the multiple wildcard should also be given. The exclusion character defines this routine to be a search through delimited character data, where the exclusion character is part of the delimiter.
  549.  
  550. If a matching address list block is specified, on exit it is updated with addresses of matching strings. If the buffer was filled before the search could be completed, the call can be repeated to obtain subsequent lists of matches.
  551.  
  552. N.B. If the matching address list was filled up, R6 contains the match which would not fit in the list. The number of matches (returned in R5) includes this one.
  553.  
  554. This routine requires the lower case character translation table provided via the TerritoryManager module, which should be installed prior to calling this routine. If you are using RISC OS 2, you will need to build your own wildcarded search around KaData_SearchAlpha (SWI &48C24), as this does not use a table.
  555.  
  556. Related SWIs
  557.  
  558. KaData_SearchAlpha (SWI &482C4), KaData_SearchWildString (SWI &482C5),
  559. KaData_SpecificSearch (SWI &482C7), KaData_MatchWild (SWI &482D8)
  560.  
  561. Related vectors
  562.  
  563. None
  564.  
  565.  
  566. KaData_SpecificSearch
  567. (SWI &482C7)
  568.     Search through a structure
  569.  
  570. On entry
  571.  
  572. R0 = reason code
  573. other registers are parameters and depend upon the reason code
  574.  
  575. On exit
  576.  
  577. R0 preserved
  578. other registers depend on the reason code
  579.  
  580. Interrupts
  581.  
  582. Interrupt status is not altered
  583. Fast interrupts are enabled
  584.  
  585. Processor mode
  586.  
  587. Processor is in SVC mode
  588.  
  589. Re-entrancy
  590.  
  591. SWI is re-entrant
  592.  
  593. Use
  594.  
  595. This is a multi-purpose routine used to search through a variety of structures for a particular element.
  596.  
  597. R0    Action
  598. 0    Object seek by name (type I, linear)
  599. 1    Object seek by name (type I, binary)
  600.  
  601. Related SWIs
  602.  
  603. KaData_MatchWild (SWI &482D8), Territory_Collate (SWI &4305D)
  604.  
  605. Related vectors
  606.  
  607. None
  608.  
  609.  
  610. KaData_SpecificSearch 0 and 1
  611. (SWI &482C7)
  612.     Search for an object by name given a table of pointers
  613.  
  614. On entry
  615.  
  616. R0 = 0 (linear wildcarded match) or 1 (binary non-wildcarded match)
  617. R1 = address base (0 if pointers are absolute addresses)
  618. R2 = pointer to table of pointers
  619. R3 = number of pointers in table
  620. R4 = map to find each object's name
  621. R5 = pointer to object name to seek (null terminated)
  622.  
  623. On exit
  624.  
  625. R0,R1 preserved
  626. R2 = if R0=0 on entry, pointer to table entry of first matching object (or -1 if none matched)
  627. R2 = if R0=1 on entry, pointer to table entry of matching object (or insertion point if none matched)
  628. R3 = if R0=0 on entry, number of pointers unchecked
  629. R3 = if R0=1 on entry, 0 if none matched, else non-zero
  630. R4,R5 preserved
  631.  
  632. Interrupts
  633.  
  634. Interrupt status is not altered
  635. Fast interrupts are enabled
  636.  
  637. Processor mode
  638.  
  639. Processor is in SVC mode
  640.  
  641. Re-entrancy
  642.  
  643. SWI is re-entrant
  644.  
  645. Use
  646.  
  647. This routine is used by KaData and AddressDevice DA to find an object given its name. In KaData, it picks a subobject out of a collection object, and in AddressDevice DA, it picks an object out of a directory.
  648.  
  649. R4 gives the routine directions on how to find the object name from each pointer, as follows:
  650.  
  651. Bits    Meaning
  652. 0-7    Offset to name in each object (or adjustment to add to name offset)
  653. 8-15    Offset to name offset in each object (1 if no name offset used)
  654. 16-30    Reserved (must be 0)
  655. 31    Set to indicate that pointers in table indirect through anchors
  656.  
  657. If R0 = 0 on entry, the object name pointed to by R5 may contain the following wildcard characters:
  658.  
  659. #    Matches any character
  660. *    Matches a sequence of characters of any length from 0 upwards
  661.  
  662. The character "." is considered to be an alternative terminator, to complete the similarity of the matching scheme with filing systems.
  663.  
  664. The search is performed with case insensitive comparisons using KaData_MatchWild (SWI &482D8). This requires the lower case character translation table provided via the TerritoryManager module, which should be installed prior to calling this routine.
  665.  
  666. The routine may be called multiple times to obtain each matching object. Note that R2 should be advanced by one word (4 bytes) so that it points to the object after the one which matched. R3 is already set-up with the correct value to proceed with the search.
  667.  
  668. If R0 = 1 on entry, a binary search is employed, which assumes that the table of pointers is sorted in ascending order of object name. Territory_Collate (SWI &4305D) is used to compare (case insensitively) each object name against the one which is being looked for, so this reason code is only valid if the TerritoryManager module is installed. Wildcards cannot be used, and the terminator must be a null.
  669.  
  670.  
  671. KaData_Filer
  672. (SWI &482C8)
  673.     Provides support calls for a Filer-like application
  674.  
  675. On entry
  676.  
  677. R0 = reason code
  678. other registers are parameters and depend upon the reason code
  679.  
  680. On exit
  681.  
  682. registers depend on the reason code
  683.  
  684. Interrupts
  685.  
  686. Interrupt status is undefined
  687. Fast interrupts are enabled
  688.  
  689. Processor mode
  690.  
  691. Processor is in SVC mode
  692.  
  693. Re-entrancy
  694.  
  695. Not defined
  696.  
  697. Use
  698.  
  699. This SWI provides a number of calls for Filer-like applications.
  700.  
  701. R0    Action
  702. 0    Check leafname for wildcards
  703. 1    Validate non-wildcarded leafname
  704. 2    Find next element of pathname
  705.  
  706. Related SWIs
  707.  
  708. None
  709.  
  710. Related vectors
  711.  
  712. None
  713.  
  714.  
  715. KaData_Filer 0
  716. (SWI &482C8)
  717.     Checks whether an object leafname contains wildcards
  718.  
  719. On entry
  720.  
  721. R0 = 0
  722. R1 = pointer to object leafname (null or period terminated)
  723.  
  724. On exit
  725.  
  726. R0,R1 preserved
  727. Z set if object leafname does not contain wildcards
  728.  
  729. Interrupts
  730.  
  731. Interrupt status is not altered
  732. Fast interrupts are enabled
  733.  
  734. Processor mode
  735.  
  736. Processor is in SVC mode
  737.  
  738. Re-entrancy
  739.  
  740. SWI is re-entrant
  741.  
  742. Use
  743.  
  744. This routine is used by AddressDevice DA to determine if a binary search can be used to resolve pathname elements. It could be used in a similar way by other filing systems.
  745.  
  746.  
  747. KaData_Filer 1
  748. (SWI &482C8)
  749.     Checks whether an object leafname contains invalid characters
  750.  
  751. On entry
  752.  
  753. R0 = 1
  754. R1 = pointer to object leafname (control or space terminated)
  755.  
  756. On exit
  757.  
  758. R0 = if Z set on exit, length of leafname, else corrupted
  759. R1 preserved
  760. Z set if object leafname does not contain invalid characters
  761.  
  762. Interrupts
  763.  
  764. Interrupt status is not altered
  765. Fast interrupts are enabled
  766.  
  767. Processor mode
  768.  
  769. Processor is in SVC mode
  770.  
  771. Re-entrancy
  772.  
  773. SWI is re-entrant
  774.  
  775. Use
  776.  
  777. This routine is used by AddressDevice DA to determine if a discname contains invalid characters. Invalid characters are:
  778.  
  779. $&%@\^:.#*"|
  780.  
  781.  
  782. KaData_Filer 2
  783. (SWI &482C8)
  784.     Finds the next element of a pathname
  785.  
  786. On entry
  787.  
  788. R0 = 2
  789. R1 = pointer to partial pathname
  790.  
  791. On exit
  792.  
  793. R0 preserved
  794. R1 = pointer to partial pathname, with the first element skipped
  795. Z set if pathname complete (in which case R1 points after null)
  796.  
  797. Interrupts
  798.  
  799. Interrupt status is not altered
  800. Fast interrupts are enabled
  801.  
  802. Processor mode
  803.  
  804. Processor is in SVC mode
  805.  
  806. Re-entrancy
  807.  
  808. SWI is re-entrant
  809.  
  810. Use
  811.  
  812. This routine is used by AddressDevice DA to read successive pathname elements.
  813.  
  814.  
  815. KaData_FillBytes
  816. (SWI &482C9)
  817.     Fill a block of memory with a specified byte or word value
  818.  
  819. On entry
  820.  
  821. R1 = byte to fill with (or if R1 > 255, special word designator)
  822. R2 = destination address
  823. R3 = length
  824.  
  825. On exit
  826.  
  827. R0-R3 corrupted
  828.  
  829. Interrupts
  830.  
  831. Interrupt status is not altered
  832. Fast interrupts are enabled
  833.  
  834. Processor mode
  835.  
  836. Processor is in SVC mode
  837.  
  838. Re-entrancy
  839.  
  840. SWI is re-entrant
  841.  
  842. Use
  843.  
  844. This is a fast memory initialization routine, internally similar to KaData_MoveBytes (SWI &482C0). It initializes any number of bytes (>0) at the destination address.
  845.  
  846. If R1 < 256 on entry, the memory is filled with bytes having the value of R1. If R1 > 255 on entry, the memory is filled with words having the value of -x, where x is R1 rotated left by 16 bits. This allows fills to use word values from 0 to 2 147 483 647, and negative values from -65 536 to -1.
  847.  
  848. If, when filling with words, the initial address is not word aligned, the low byte of x is used to pad to the next word boundary. Similar padding is carried out at the end of the initialized memory if it does not finish on a word boundary.
  849.  
  850. Related SWIs
  851.  
  852. KaData_MoveBytes (SWI &482C0)
  853.  
  854. Related vectors
  855.  
  856. None
  857.  
  858.  
  859. KaData_ReadInteger
  860. (SWI &482CA)
  861.     Not yet implemented
  862.  
  863.  
  864. KaData_WriteInteger
  865. (SWI &482CB)
  866.     Not yet implemented
  867.  
  868.  
  869. KaData_CountBytes
  870. (SWI &482CC)
  871.     Do an indexed search for a particular byte value (bi-directional)
  872.  
  873. On entry
  874.  
  875. R0 = byte value to count
  876. R1 = start address
  877. R2 = maximum number to count
  878. R3 = length of block to be searched (negative to search backwards)
  879.  
  880. On exit
  881.  
  882. R0 = address of last match (-1 if no matches found)
  883. R1 = address of byte where search would resume
  884. R2 = number left to count
  885. R3 = number of unexamined bytes (negative if searching backwards)
  886.  
  887. Interrupts
  888.  
  889. Interrupt status is not altered
  890. Fast interrupts are enabled
  891.  
  892. Processor mode
  893.  
  894. Processor is in SVC mode
  895.  
  896. Re-entrancy
  897.  
  898. SWI is re-entrant
  899.  
  900. Use
  901.  
  902. This routine can be used to skip to terminators or delimiters in a block of bytes.
  903.  
  904.  
  905. KaData_GetEntryPoints
  906. (SWI &482CD)
  907.     Provides addresses of SWI handler routines and related support
  908.  
  909. On entry
  910.  
  911. R0 = SWI offset (or negative for special reason code)
  912. R1 = address of buffer to store 65 addresses (if R0=-1 on entry)
  913.  
  914. On exit
  915.  
  916. R0 preserved
  917. R1 = address beyond end of buffer (if R0=-1 on entry, preserved otherwise)
  918. R2 = address of given SWI handler (or maximum SWI offset if R0=-1 on entry)
  919.  
  920. Interrupts
  921.  
  922. Interrupt status is not altered
  923. Fast interrupts are enabled
  924.  
  925. Processor mode
  926.  
  927. Processor is in SVC mode
  928.  
  929. Re-entrancy
  930.  
  931. SWI is re-entrant
  932.  
  933. Use
  934.  
  935. The meaning of this call depends on the value of R0 as follows:
  936.  
  937. R0    Meaning
  938. 0-63    Return address of specific SWI handler in R2 (for SWI offset in R0)
  939. -1    Return address of all handlers in buffer pointed to by R1
  940. -2    Return address of main SWI handler in R2
  941. -3    Anchor module
  942. -4    Release module
  943.  
  944. When you specify R0 = -1, the layout of the buffer is:
  945.  
  946. Offset    Meaning
  947. 0    Address of main SWI handler (SWI chunk &482C0)
  948. 4    Address of handler for KaData_MoveBytes (SWI offset 0)
  949. :
  950. 256    Address of handler for KaData_Undefined63 (SWI offset 63)
  951.  
  952. In this instance, R2 returns the highest defined SWI offset in the chunk.
  953.  
  954. If you specify R0 > 0 on entry, but there is no handler for that SWI offset, then R2 will contain 0 on exit.
  955.  
  956. All addresses returned are absolute, but depend on the current address of the KaData module in the RMA address space. In order to use them, you should first call this routine with R0 = -3 to anchor the module in the RMA. When you have finished using the entry points, be sure to use R0 = -4 to release it. Ideally, you should not anchor the module for long periods of time in a multitasking environment.
  957.  
  958. The following entry points require R12 be set-up to point to the KaData module's private word, and must be called in Supervisor mode:
  959.  
  960. KaData_MetronomicTimerOn (SWI &482D2)
  961. KaData_MetronomicTimerOff (SWI &482D3)
  962. KaData_MetronomicTimerSmash (SWI &482D4)
  963. KaData_ReadMetronomicTimer (SWI &482D5)
  964.  
  965. For any other entry point returned by this routine:
  966.  
  967. On entry:    Entry registers as for SWI
  968.         R13 must be a full descending stack with 512 bytes free
  969.         R11, R12, R14 may contain any value (unless stated o/w)
  970.         Processor is in a 26-bit PC mode
  971.         Interrupt status is undefined
  972. On exit:    Exit registers (and flags) as for SWI
  973.         R10-R12 may be corrupted
  974.         Processor mode is unchanged
  975.         Interrupt status is unaltered
  976. Re-entrancy:    Check SWI documentation for re-entrancy
  977.  
  978. Note that KaData_MoveBytes (SWI &482C0) is an APCS compliant entry point. All others are not, and will require wrapping code to be called as an APCS compliant entry point. A wrapper would move R1 to R0, R2 to R1, etc., preserve the necessary registers, make the call, and do the inverse on exit.
  979.  
  980. Related SWIs
  981.  
  982. None
  983.  
  984. Related vectors
  985.  
  986. None
  987.  
  988. Related variables
  989.  
  990. KaData$ModuleAnchor
  991.  
  992.  
  993. KaData_CallSupervisor32
  994. (SWI &482CE)
  995.     Calls a routine in ARM Supervisor32 mode (not implemented in 0.51)
  996.  
  997. On entry
  998.  
  999. R0-R7 as required for routine 
  1000. R8 = address of routine to call
  1001. R9 = R12 value for entry to routine
  1002. R10,R11 as required for routine (R11 applicable only if called directly)
  1003. R12 = KaData module instantiation private word pointer (if called directly)
  1004. R13 = supervisor stack pointer (if called directly)
  1005. R14 = flags and 26-bit PC return value for call (if called directly)
  1006.  
  1007. On exit
  1008.  
  1009. R0-R10 and flags as returned by routine
  1010. R11-R13 as returned by routine (if called directly)
  1011.  
  1012. Interrupts
  1013.  
  1014. Interrupts are disabled
  1015. Fast interrupts are disabled temporarily (before entry to the routine)
  1016.  
  1017. Processor mode
  1018.  
  1019. Processor is in SVC26 mode on entry and exit
  1020. Routine is executed in SVC32 mode, with KaData SVC32 SWI handler enabled
  1021.  
  1022. Re-entrancy
  1023.  
  1024. SWI is not re-entrant
  1025.  
  1026. Use
  1027.  
  1028. This call is for RISC OS 3.50 and above only.
  1029.  
  1030. This SWI can be used to call routines which:
  1031.  
  1032. -    lie outside 26-bit address space
  1033. -    end up calling routines which are outside 26-bit address space
  1034.  
  1035. The entry process involves:
  1036.  
  1037. -    claiming processor SWI vector, or, if a different approach is
  1038.     suggested by a call to KaData_ChangeProcessorVector32 (SWI &482CF),
  1039.     this will be followed instead.
  1040. -    forcing ARM to enter Supervisor32 mode
  1041. -    saving KaData R12 on the stack and loading R12 with R9
  1042. -    calling the routine
  1043.  
  1044. The exit process involves:
  1045.  
  1046. -    saving routine exit R12 and retrieving KaData R12
  1047. -    releasing processor SWI vector, or, if a different approach is
  1048.     suggested by a call to KaData_ChangeProcessorVector32 (SWI &482CF),
  1049.     this will be followed instead.
  1050. -    forcing ARM to enter Supervisor26 mode
  1051. -    retrieving routine exit R12
  1052.  
  1053. If the default entry and exit actions have not been overridden by KaData_ChangeProcessorVector32, the replaced SWI vector performs as follows:
  1054.  
  1055. -    The KaData SWI claimant needs to patch to the OS SWI handler with a
  1056.     routine that can work around the clipping of R14_svc which the OS
  1057.     SWI handler performs to retrieve the SWI instruction. (This forces
  1058.     R14_svc into 26-bit space, which can yield an incorrect instruction
  1059.     and an incorrect return address.) To be able to do this, the routine
  1060.     needs to fake a SWI call in 26-bit space. This is done, in broad
  1061.     terms, using OS_CallASWI.
  1062.  
  1063. Related SWIs
  1064.  
  1065. OS_ClaimProcessorVector (SWI &69), OS_CallASWI (SWI &6F),
  1066. KaData_ChangeProcessorVector32 (SWI &482CF)
  1067.  
  1068. Related vectors
  1069.  
  1070. Processor SWI vector (Location &08)
  1071.  
  1072.  
  1073. KaData_ChangeProcessorVector32
  1074. (SWI &482CF)
  1075.     Changes the exception handlers used by KaData_CallSupervisor32
  1076.     (not implemented in 0.51)
  1077.  
  1078. On entry
  1079.  
  1080. R0 = vector claim routine (or R0 = 0 to restore default actions)
  1081. R1 = vector release routine
  1082.  
  1083. On exit
  1084.  
  1085. R0 = previous vector claim routine
  1086. R1 = previous vector release routine
  1087.  
  1088. Interrupts
  1089.  
  1090. Interrupts are disabled
  1091. Fast interrupts are enabled
  1092.  
  1093. Processor mode
  1094.  
  1095. Processor is in SVC mode
  1096.  
  1097. Re-entrancy
  1098.  
  1099. SWI is not re-entrant
  1100.  
  1101. Use
  1102.  
  1103. This call is for RISC OS 3.50 and above only.
  1104.  
  1105. This call is intended for changing the entry and exit sequence followed by KaData_CallSupervisor32 (SWI &482CE). The normal action of such routines is to replace and subsequently restore the processor vectors to facilitate running in SVC32 mode.
  1106.  
  1107. R0 should be set to the address of your vector claim routine, which is entered in SVC26 mode. R1 should be set to the address of your vector release routine, which is entered in SVC32 mode. If you set R0 = 0 on entry, the default actions will be restored.
  1108.  
  1109. If you claim a processor vector within your vector claim routine, the handlers you set up will be called during the execution of a SVC32 routine running under KaData_CallSupervisor32 (SWI &482CE). This means:
  1110.  
  1111. -    Handlers which set themselves up within your routine are called
  1112.     "KaData claimants". These claimants will be called from a parent
  1113.     environment that is in Supervisor32 mode, unless your routine is
  1114.     presently threaded more than once.
  1115.     
  1116. -    Routines which set themselves up with the operating system, and are
  1117.     the owners of the vectors when KaData_CallSupervisor32 is entered,
  1118.     are called "actual claimants". These claimants are usually defined
  1119.     to execute in 26-bit processor modes as follows:
  1120.  
  1121.     Number    Vector name (default claimant; 26-bit processor mode)
  1122.     0    Reset (branch through zero error; SVC)
  1123.     1    Undefined instruction (coprocessor instruction emulator; SVC)
  1124.     2    SWI (operating system software interrupt handler; SVC)
  1125.     3    Prefetch abort (abort on instruction fetch error; SVC)
  1126.     4    Data abort (abort on data transfer error; SVC)
  1127.     5    Reserved (address exception error)
  1128.     6    IRQ (operating system interrupt handler; IRQ)
  1129.     7    FIQ (current FIQ claimant; FIQ)
  1130.  
  1131. So, the purpose of your vector claim routine is to replace actual claimants with your KaData claimants. And the purpose of your vector release routine is to restore the actual claimants. Usually KaData claimants need to access the actual claimants, and merely perform pre and post processing on the vectors to ensure the desired actions be taken for code running in Supervisor32 mode.
  1132.  
  1133. Related SWIs
  1134.  
  1135. OS_ClaimProcessorVector (SWI &69), KaData_CallSupervisor32 (SWI &482CE)
  1136.  
  1137. Related vectors
  1138.  
  1139. All processor vectors (Locations &00-&1C)
  1140.  
  1141.  
  1142. KaData_OSModule
  1143. (SWI &482D0)
  1144.     Perform a module operation using AddressDevice DA
  1145.     (not implemented in 0.51)
  1146.  
  1147. On entry
  1148.  
  1149. R0 = reason code
  1150. other registers are parameters and depend upon the reason code
  1151.  
  1152. On exit
  1153.  
  1154. R0 preserved (except for reason codes > 127)
  1155. other registers depend on the reason code
  1156.  
  1157. Interrupts
  1158.  
  1159. Interrupt status is undefined
  1160. Fast interrupts are enabled
  1161.  
  1162. Processor mode
  1163.  
  1164. Processor is in SVC mode
  1165.  
  1166. Re-entrancy
  1167.  
  1168. Not defined
  1169.  
  1170. Use
  1171.  
  1172. This call is for RISC OS 3.50 and above only.
  1173.  
  1174. This SWI provides a number of calls to manipulate modules, using the features available in the AddressDevice DA module area filing system (&FFA).
  1175.  
  1176. R0    Action
  1177. 128    TabModule initialize (for internal use only)
  1178. 129    TabModule finalize (for internal use only)
  1179. 130    TabModule start code (for internal use only)
  1180. 131    TabModule service handler (for internal use only)
  1181. 132    TabModule SWI handler (for internal use only)
  1182. 133    TabModule SWI decoding code (for internal use only)
  1183.  
  1184. Related SWIs
  1185.  
  1186. OS_Module (SWI &1E), KaData_OSModuleRegister (SWI <none yet>)
  1187.  
  1188. Related vectors
  1189.  
  1190. None
  1191.  
  1192.  
  1193. KaData_OSModule 128
  1194. (SWI &482D0)
  1195.     Initializes a module in 32-bit space
  1196.  
  1197. On entry
  1198.  
  1199. R0 = 128
  1200. R2 = TabModule address
  1201. R6 = actual module header address
  1202. R9 = pointer to module private word
  1203.  
  1204. On exit
  1205.  
  1206. Undefined
  1207.  
  1208. Use
  1209.  
  1210. This call pokes TabModule fields to simulate the behaviour of the actual
  1211. module (which is stored in 32-bit space) as follows:
  1212.  
  1213. -    It will disable the start field for actual modules with a zero in
  1214.     this field.
  1215. -    It will disable the service call field for modules with a zero in
  1216.     this field.
  1217. -    It will adjust the offset in the title field so that it points to
  1218.     title string in the actual module.
  1219. -    It will adjust the offset in the help field so that it points to
  1220.     title string in the actual module.
  1221. -    It will adjust the offset in the keywords field so that it points to
  1222.     keyword table in the actual module.
  1223. -    It will disable the SWI handler field for modules with a zero in
  1224.     this field.
  1225. -    It will adjust the offset in the SWI table field so that it points to
  1226.     SWI table in the actual module.
  1227. -    It will disable the SWI decoder field for modules with a zero in
  1228.     this field.
  1229. -    The TabModule is poked with the location of the KaData_OSModule SWI
  1230.     decoder (not used in AddressDevice 2.00 prototype).
  1231.  
  1232. The routine then calls the initialization routine of the actual module (where present), in SVC32 mode. KaData is anchored in RMA, if it is not already.
  1233.  
  1234.  
  1235. KaData_OSModule 129
  1236. (SWI &482D0)
  1237.     Finalizes a module in 32-bit space
  1238.  
  1239. On entry
  1240.  
  1241. R0 = 129
  1242. R2 = TabModule address
  1243. R6 = actual module header address
  1244. R9 = pointer to module private word
  1245.  
  1246. On exit
  1247.  
  1248. Undefined
  1249.  
  1250. Use
  1251.  
  1252. This routine calls the finalization routine of the actual module (where present), in SVC32 mode. KaData is deanchored provided it isn't anchored by another part of the system (e.g. another SVC32 module).
  1253.  
  1254.  
  1255. KaData_OSModule 130
  1256. (SWI &482D0)
  1257.     Starts executing a module in 32-bit space
  1258.  
  1259. On entry
  1260.  
  1261. R0 = 130
  1262. R1 = actual module header address
  1263. R9 = pointer to module private word
  1264.  
  1265. On exit
  1266.  
  1267. R0 = pointer to error block
  1268. V set
  1269.  
  1270. Use
  1271.  
  1272. This routine cannot reasonably be implemented at this time, so it returns an error.
  1273.  
  1274.  
  1275. KaData_OSModule 131
  1276. (SWI &482D0)
  1277.     Invokes the service call handler code of a module in 32-bit space
  1278.  
  1279. On entry
  1280.  
  1281. R0 = 131
  1282. R8 = actual module header address
  1283. R9 = pointer to module private word
  1284.  
  1285. On exit
  1286.  
  1287. Undefined
  1288.  
  1289. Use
  1290.  
  1291. Enters SVC32 mode, and calls the actual module code.
  1292.  
  1293.  
  1294. KaData_OSModule 132
  1295. (SWI &482D0)
  1296.     Invokes the SWI handler code of a module in 32-bit space
  1297.  
  1298. On entry
  1299.  
  1300. R0 = 132
  1301. R8 = actual module header address
  1302. R9 = pointer to module private word
  1303.  
  1304. On exit
  1305.  
  1306. Undefined
  1307.  
  1308. Use
  1309.  
  1310. Enters SVC32 mode, and calls the actual module code.
  1311.  
  1312.  
  1313. KaData_OSModule 133
  1314. (SWI &482D0)
  1315.     Invokes the SWI decoder code of a module in 32-bit space
  1316.  
  1317. On entry
  1318.  
  1319. R0 = 133
  1320. R8 = actual module header address
  1321. R9 = pointer to module private word
  1322.  
  1323. On exit
  1324.  
  1325. Undefined
  1326.  
  1327. Use
  1328.  
  1329. Enters SVC32 mode, and calls the actual module code.
  1330.  
  1331.  
  1332. KaData_Assemble
  1333. (SWI &482D1)
  1334.  
  1335. Assembles an ARM instruction
  1336.  
  1337. On entry
  1338.  
  1339. R0 = execution address of instruction
  1340. R1 = pointer to word to contain assembled instruction
  1341. R2 = base instruction code
  1342. R3 = condition code
  1343. other registers depend on base instruction code
  1344.  
  1345. On exit
  1346.  
  1347. -
  1348.  
  1349. Interrupts
  1350.  
  1351. Interrupt status is not defined
  1352. Fast interrupts are enabled
  1353.  
  1354. Processor mode
  1355.  
  1356. Processor is in SVC mode
  1357.  
  1358. Re-entrancy
  1359.  
  1360. SWI is re-entrant
  1361.  
  1362. Use
  1363.  
  1364. This general purpose SWI assembles an ARM instruction from data specified by the entry registers, and stores it at the address specified.
  1365.  
  1366. The following table lists the condition codes:
  1367.  
  1368. Condition    Code
  1369. AL        &E
  1370. CC        &3
  1371. CS        &2
  1372. EQ        &0
  1373. GE        &A
  1374. GT        &C
  1375. HI        &8
  1376. HS        &2
  1377. LE        &D
  1378. LO        &3
  1379. LS        &9
  1380. LT        &B
  1381. MI        &4
  1382. PL        &5
  1383. NE        &1
  1384. NV        &F
  1385. VC        &7
  1386. VS        &6
  1387.  
  1388. The following table is a summary of base instruction codes and the entry register values required:
  1389.  
  1390. Instruction        Code        R4    R5    R6    R7
  1391. ABS            &F2        FPR    FD    0    FS1
  1392. ABS            &F20        FPR    FD    0    FC
  1393. ACS            &FC        FPR    FD    0    FS1
  1394. ACS            &FC0        FPR    FD    0    FC
  1395. ADC            &0A        D    S1    S2    Shift
  1396. ADC            &2A        D    S1    Const    -
  1397. ADCS            &0B        D    S1    S2    Shift
  1398. ADCS            &2B        D    S1    Const    -
  1399. ADD            &08        D    S1    S2    Shift
  1400. ADD            &28        D    S1    Const    -
  1401. ADDS            &09        D    S1    S2    Shift
  1402. ADDS            &29        D    S1    Const    -
  1403. ADF            &E0        FPR    FD    FS1    FS2
  1404. ADF            &E00        FPR    FD    FS1    FC
  1405. AND            &00        D    S1    S2    Shift
  1406. AND            &20        D    S1    Const    -
  1407. ANDS            &01        D    S1    S2    Shift
  1408. ANDS            &21        D    S1    Const    -
  1409. ASN            &FB        FPR    FD    0    FS1
  1410. ASN            &FB0        FPR    FD    0    FC
  1411. ATN            &FD        FPR    FD    0    FS1
  1412. ATN            &FD0        FPR    FD    0    FC
  1413. B            &A0        Addr    -    -    -
  1414. BL            &B0        Addr    -    -    -
  1415. BIC            &1C        D    S1    S2    Shift
  1416. BIC            &3C        D    S1    Const    -
  1417. BICS            &1D        D    S1    S2    Shift
  1418. BICS            &3D        D    S1    Const    -
  1419. CMF            &A8        FPR    7    FS1    FS2
  1420. CMF            &A80        FPR    7    FS1    FC
  1421. CMFE            &AA        FPR    7    FS1    FS2
  1422. CMFE            &AA0        FPR    7    FS1    FC
  1423. CMN            &17        0    S1    S2    Shift
  1424. CMN            &37        0    S1    Const    -
  1425. CMNP            &17        15    S1    S2    Shift
  1426. CMNP            &37        15    S1    Const    -
  1427. CMP            &15        0    S1    S2    Shift
  1428. CMP            &35        0    S1    Const    -
  1429. CMPP            &15        15    S1    S2    Shift
  1430. CMPP            &35        15    S1    Const    -
  1431. CNF            &A9        FPR    7    FS1    FS2
  1432. CNF            &A90        FPR    7    FS1    FC
  1433. CNFE            &AB        FPR    7    FS1    FS2
  1434. CNFE            &AB0        FPR    7    FS1    FC
  1435. COS            &F9        FPR    FD    0    FS1
  1436. COS            &F90        FPR    FD    0    FC
  1437. DVF            &E4        FPR    FD    FS1    FS2
  1438. DVF            &E40        FPR    FD    FS1    FC
  1439. EOR            &02        D    S1    S2    Shift
  1440. EOR            &22        D    S1    Const    -
  1441. EORS            &03        D    S1    S2    Shift
  1442. EORS            &23        D    S1    Const    -
  1443. EXP            &F7        FPR    FD    0    FS1
  1444. EXP            &F70        FPR    FD    0    FC
  1445. FML            &E9        FPR    FD    FS1    FS2
  1446. FML            &E90        FPR    FD    FS1    FC
  1447. FDV            &EA        FPR    FD    FS1    FS2
  1448. FDV            &EA0        FPR    FD    FS1    FC
  1449. FIX            &A10        FPR    FS1    D    -
  1450. FLT            &A00        FPR    FD    S1    -
  1451. FRD            &EB        FPR    FD    FS1    FS2
  1452. FRD            &EB0        FPR    FD    FS1    FC
  1453. LDF (DA)        &C1        FPR    FR    A1    Offset
  1454. LDF (IA)        &C9        FPR    FR    A1    Offset
  1455. LDF (DB)        &D1        FPR    FR    A1    Offset
  1456. LDF (DB!)        &D3        FPR    FR    A1    Offset
  1457. LDF (IB)        &D9        FPR    FR    A1    Offset
  1458. LDF (IB!)        &DB        FPR    FR    A1    Offset
  1459. LDMDA            &81        A1    L    -    -
  1460. LDMDA (!)        &83        A1    L    -    -
  1461. LDMDA (^)        &85        A1    L    -    -
  1462. LDMDA (!^)        &87        A1    L    -    -
  1463. LDMDB            &91        A1    L    -    -
  1464. LDMDB (!)        &93        A1    L    -    -
  1465. LDMDB (^)        &95        A1    L    -    -
  1466. LDMDB (!^)        &97        A1    L    -    -
  1467. LDMEA            is equivalent to LDMDB
  1468. LDMED            is equivalent to LDMIB
  1469. LDMFA            is equivalent to LDMDA
  1470. LDMFD            is equivalent to LDMIA
  1471. LDMIA            &89        A1    L    -    -
  1472. LDMIA (!)        &8B        A1    L    -    -
  1473. LDMIA (^)        &8D        A1    L    -    -
  1474. LDMIA (!^)        &8F        A1    L    -    -
  1475. LDMIB            &99        A1    L    -    -
  1476. LDMIB (!)        &9B        A1    L    -    -
  1477. LDMIB (^)        &9D        A1    L    -    -
  1478. LDMIB (!^)        &9F        A1    L    -    -
  1479. LDR            &59        R    15    Addr    -
  1480. LDR (DA)        &41        R    A1    Offset    -
  1481. LDR (DA)        &61        R    A1    A2    Shift
  1482. LDR (DB)        &51        R    A1    Offset    -
  1483. LDR (DB)        &71        R    A1    A2    Shift
  1484. LDR (IA)        &49        R    A1    Offset    -
  1485. LDR (IA)        &69        R    A1    A2    Shift
  1486. LDR (IB)        &59        R    A1    Offset    -
  1487. LDR (IB)        &79        R    A1    A2    Shift
  1488. LDR (DB!)        &53        R    A1    Offset    -
  1489. LDR (DB!)        &73        R    A1    A2    Shift
  1490. LDR (IB!)        &5B        R    A1    Offset    -
  1491. LDR (IB!)        &7B        R    A1    A2    Shift
  1492. LDRB (DA)        &45        R    A1    Offset    -
  1493. LDRB (DA)        &65        R    A1    A2    Shift
  1494. LDRB (DB)        &55        R    A1    Offset    -
  1495. LDRB (DB)        &75        R    A1    A2    Shift
  1496. LDRB (IA)        &4D        R    A1    Offset    -
  1497. LDRB (IA)        &6D        R    A1    A2    Shift
  1498. LDRB (IB)        &5D        R    A1    Offset    -
  1499. LDRB (IB)        &7D        R    A1    A2    Shift
  1500. LDRB (DB!)        &57        R    A1    Offset    -
  1501. LDRB (DB!)        &77        R    A1    A2    Shift
  1502. LDRB (IB!)        &5F        R    A1    Offset    -
  1503. LDRB (IB!)        &7F        R    A1    A2    Shift
  1504. LDRBT (DA)        &47        R    A1    Offset    -
  1505. LDRBT (DA)        &67        R    A1    A2    Shift
  1506. LDRBT (IA)        &4F        R    A1    Offset    -
  1507. LDRBT (IA)        &6F        R    A1    A2    Shift
  1508. LDRT (DA)        &43        R    A1    Offset    -
  1509. LDRT (DA)        &63        R    A1    A2    Shift
  1510. LDRT (IA)        &4B        R    A1    Offset    -
  1511. LDRT (IA)        &6B        R    A1    A2    Shift
  1512. LGN            &F6        FPR    FD    0    FS1
  1513. LGN            &F60        FPR    FD    0    FC
  1514. LOG            &F5        FPR    FD    0    FS1
  1515. LOG            &F50        FPR    FD    0    FC
  1516. MLA            &30        D    S1    S2    S3
  1517. MNF            &F1        FPR    FD    0    FS1
  1518. MNF            &F10        FPR    FD    0    FC
  1519. MOV            &15        D    0    S1    Shift
  1520. MOV            &35        D    0    Const    -
  1521. MUF            &E1        FPR    FD    FS1    FS2
  1522. MUF            &E10        FPR    FD    FS1    FC
  1523. MUL            &10        D    S1    S2    0
  1524. MVF            &F0        FPR    FD    0    FS1
  1525. MVF            &F00        FPR    FD    0    FC
  1526. MVN            &17        D    0    S1    Shift
  1527. MVN            &37        D    0    Const    -
  1528. ORR            &18        D    S1    S2    Shift
  1529. ORR            &38        D    S1    Const    -
  1530. ORRS            &19        D    S1    S2    Shift
  1531. ORRS            &39        D    S1    Const    -
  1532. POL            &EC        FPR    FD    FS1    FS2
  1533. POL            &EC0        FPR    FD    FS1    FC
  1534. POW            &E6        FPR    FD    FS1    FS2
  1535. POW            &E60        FPR    FD    FS1    FC
  1536. RDF            &E5        FPR    FD    FS1    FS2
  1537. RDF            &E50        FPR    FD    FS1    FC
  1538. RFC            &A50        0    0    D    -
  1539. RFS            &A30        0    0    D    -
  1540. RMF            &E8        FPR    FD    FS1    FS2
  1541. RMF            &E80        FPR    FD    FS1    FC
  1542. RND            &F3        FPR    FD    0    FS1
  1543. RND            &F30        FPR    FD    0    FC
  1544. RPW            &E7        FPR    FD    FS1    FS2
  1545. RPW            &E70        FPR    FD    FS1    FC
  1546. RSB            &06        D    S1    S2    Shift
  1547. RSB            &26        D    S1    Const    -
  1548. RSBS            &07        D    S1    S2    Shift
  1549. RSBS            &27        D    S1    Const    -
  1550. RSC            &0E        D    S1    S2    Shift
  1551. RSC            &2E        D    S1    Const    -
  1552. RSCS            &0F        D    S1    S2    Shift
  1553. RSCS            &2F        D    S1    Const    -
  1554. RSF            &E3        FPR    FD    FS1    FS2
  1555. RSF            &E30        FPR    FD    FS1    FC
  1556. SBC            &0C        D    S1    S2    Shift
  1557. SBC            &2C        D    S1    Const    -
  1558. SBCS            &0D        D    S1    S2    Shift
  1559. SBCS            &2D        D    S1    Const    -
  1560. SIN            &F8        FPR    FD    0    FS1
  1561. SIN            &F80        FPR    FD    0    FC
  1562. SQT            &F4        FPR    FD    0    FS1
  1563. SQT            &F40        FPR    FD    0    FC
  1564. STF (DA)        &C0        FPR    FR    A1    Offset
  1565. STF (IA)        &C8        FPR    FR    A1    Offset
  1566. STF (DB)        &D0        FPR    FR    A1    Offset
  1567. STF (DB!)        &D2        FPR    FR    A1    Offset
  1568. STF (IB)        &D8        FPR    FR    A1    Offset
  1569. STF (IB!)        &DA        FPR    FR    A1    Offset
  1570. STMDA            &80        A1    L    -    -
  1571. STMDA (!)        &82        A1    L    -    -
  1572. STMDA (^)        &84        A1    L    -    -
  1573. STMDA (!^)        &86        A1    L    -    -
  1574. STMDB            &90        A1    L    -    -
  1575. STMDB (!)        &92        A1    L    -    -
  1576. STMDB (^)        &94        A1    L    -    -
  1577. STMDB (!^)        &96        A1    L    -    -
  1578. STMEA            is equivalent to STMIA
  1579. STMED            is equivalent to STMDA
  1580. STMFA            is equivalent to STMIB
  1581. STMFD            is equivalent to STMDB
  1582. STMIA            &88        A1    L    -    -
  1583. STMIA (!)        &8A        A1    L    -    -
  1584. STMIA (^)        &8C        A1    L    -    -
  1585. STMIA (!^)        &8E        A1    L    -    -
  1586. STMIB            &98        A1    L    -    -
  1587. STMIB (!)        &9A        A1    L    -    -
  1588. STMIB (^)        &9C        A1    L    -    -
  1589. STMIB (!^)        &9E        A1    L    -    -
  1590. STR            &58        R    15    Addr    -
  1591. STR (DA)        &40        R    A1    Offset    -
  1592. STR (DA)        &60        R    A1    A2    Shift
  1593. STR (DB)        &50        R    A1    Offset    -
  1594. STR (DB)        &70        R    A1    A2    Shift
  1595. STR (IA)        &48        R    A1    Offset    -
  1596. STR (IA)        &68        R    A1    A2    Shift
  1597. STR (IB)        &58        R    A1    Offset    -
  1598. STR (IB)        &78        R    A1    A2    Shift
  1599. STR (DB!)        &52        R    A1    Offset    -
  1600. STR (DB!)        &72        R    A1    A2    Shift
  1601. STR (IB!)        &5A        R    A1    Offset    -
  1602. STR (IB!)        &7A        R    A1    A2    Shift
  1603. STRB (DA)        &44        R    A1    Offset    -
  1604. STRB (DA)        &64        R    A1    A2    Shift
  1605. STRB (DB)        &54        R    A1    Offset    -
  1606. STRB (DB)        &74        R    A1    A2    Shift
  1607. STRB (IA)        &4C        R    A1    Offset    -
  1608. STRB (IA)        &6C        R    A1    A2    Shift
  1609. STRB (IB)        &5C        R    A1    Offset    -
  1610. STRB (IB)        &7C        R    A1    A2    Shift
  1611. STRB (DB!)        &56        R    A1    Offset    -
  1612. STRB (DB!)        &76        R    A1    A2    Shift
  1613. STRB (IB!)        &5E        R    A1    Offset    -
  1614. STRB (IB!)        &7E        R    A1    A2    Shift
  1615. STRBT (DA)        &46        R    A1    Offset    -
  1616. STRBT (DA)        &66        R    A1    A2    Shift
  1617. STRBT (IA)        &4E        R    A1    Offset    -
  1618. STRBT (IA)        &6E        R    A1    A2    Shift
  1619. STRT (DA)        &42        R    A1    Offset    -
  1620. STRT (DA)        &62        R    A1    A2    Shift
  1621. STRT (IA)        &4A        R    A1    Offset    -
  1622. STRT (IA)        &6A        R    A1    A2    Shift
  1623. SUB            &04        D    S1    S2    Shift
  1624. SUB            &24        D    S1    Const    -
  1625. SUBS            &05        D    S1    S2    Shift
  1626. SUBS            &25        D    S1    Const    -
  1627. SUF            &E2        FPR    FD    FS1    FS2
  1628. SUF            &E20        FPR    FD    FS1    FC
  1629. SWI            &F0        -1    SID    -    -
  1630. TAN            &FA        FPR    FD    0    FS1
  1631. TAN            &FA0        FPR    FD    0    FC
  1632. TEQ            &11        0    S1    S2    Shift
  1633. TEQ            &31        0    S1    Const    -
  1634. TEQP            &11        15    S1    S2    Shift
  1635. TEQP            &31        15    S1    Const    -
  1636. TST            &13        0    S1    S2    Shift
  1637. TST            &33        0    S1    Const    -
  1638. TSTP            &13        15    S1    S2    Shift
  1639. TSTP            &33        15    S1    Const    -
  1640. WFC            &A40        0    0    S1    -
  1641. WFS            &A20        0    0    S1    -
  1642.  
  1643. Each of the mnemonics used to indicate register contents in the above table are described below:
  1644.  
  1645. Mnemonic    Meaning                Entry register contents
  1646. A1        ARM register: first address    Cardinal, in the range 0-15
  1647. A2        ARM register: second address    Cardinal, in the range 0-15
  1648. Addr        ARM memory address        26-bit cardinal
  1649. Const        Immediate constant        32-bit cardinal
  1650. D        ARM register: destination    Cardinal, in the range 0-15
  1651. FC        FP immediate constant        The constant is specified by
  1652.                         a code in the range 0-7. The
  1653.                                 following table gives a list
  1654.                         of valid FP constants:
  1655.             Code        FP constant
  1656.             0        0.0
  1657.             1        1.0
  1658.             2        2.0
  1659.             3        3.0
  1660.             4        4.0
  1661.             5        5.0
  1662.             6        0.5
  1663.             7        10.0
  1664. FD    FP register: destination        Cardinal, in the range 0-7
  1665. FPR    FP precision and rounding        This value specifies the FP
  1666.                         precision and rounding, as
  1667.                         follows:
  1668.             Value    Instruction suffix
  1669.             0        S
  1670.             1        SP
  1671.             2        SM
  1672.             3        SZ
  1673.             4        D
  1674.             5        DP
  1675.             6        DM
  1676.             7        DZ
  1677.             8        E
  1678.             9        EP
  1679.             10        EM
  1680.             11        EZ
  1681.             12        P
  1682.             13        PP
  1683.             14        PM
  1684.             15        PZ
  1685. FR        FP register            Cardinal, in the range 0-7
  1686. FS1        FP register: first source    Cardinal, in the range 0-7
  1687. FS2        FP register: second source    Cardinal, in the range 0-7
  1688. L        ARM register list        16-bit bitmap (register
  1689.                         included if bit set)
  1690.                         e.g. R0 included if bit 0 is
  1691.                         set, R15 included if bit 15
  1692.                         is set
  1693. Offset        Memory address offset        For all instructions apart
  1694.                         from LDRB and STRB, the
  1695.                         offset must be a multiple of
  1696.                         4. For LDR, STR, LDM and
  1697.                         STM, the offset must be in
  1698.                         the range 0-4095. For LDF
  1699.                         and STF, the offset must be
  1700.                         in the range 0-4080.
  1701. R        ARM register            Cardinal, in the range 0-15
  1702. S1        ARM register: first source    Cardinal, in the range 0-15
  1703. S2        ARM register: second source    Cardinal, in the range 0-15
  1704. Shift        Register shift/rotate operation    Bits 0-2 are the subinst-
  1705.                         ruction code. If bit 0 is
  1706.                         set, then bits 3-7 are shift
  1707.                         factor. If bit 0 is unset,
  1708.                         then bits 4-7 specify the
  1709.                         ARM register containing the
  1710.                         shift factor, and bit 7 is
  1711.                         unset. The subinstruction
  1712.                         codes are listed below:
  1713.             Code        Shift/rotate subinstruction
  1714.             0        LSL #<factor>
  1715.                     ASL #<factor>
  1716.             1        LSL <register>
  1717.                     ASL <register>
  1718.             2        LSR #<factor>
  1719.             3        LSR <register>
  1720.             4        ASR #<factor>
  1721.             5        ASR <register>
  1722.             6        RRX  (<factor> = 0)
  1723.             6        ROR #<factor> (<factor> > 0)
  1724.             7        ROR <register>
  1725. SID        SWI identification number    26-bit cardinal
  1726.  
  1727. Note that is the caller's responsibility to ensure that the data passed meets the requirements specified above. For example, no error will be returned if an attempt is made to assemble an instruction which refers to R16. If the caller does not meet the requirements, then the instruction which is assembled will almost certainly perform the wrong task, if it executes at all.
  1728.  
  1729. If an immediate constant cannot be encoded, then the error Invalid immediate constant will be generated. Similarly, if an address cannot be successfully converted to a PC-relative offset, then the error Invalid address: translation to offset failed will be returned.
  1730.  
  1731. Related SWIs
  1732.  
  1733. Debugger_Disassemble (SWI &40380)
  1734.  
  1735. Related vectors
  1736.  
  1737. None
  1738.  
  1739.  
  1740. KaData_MetronomicTimerOn
  1741. (SWI &482D2)
  1742.     Start a timer using IOC Timer 1
  1743.  
  1744. On entry
  1745.  
  1746. -
  1747.  
  1748. On exit
  1749.  
  1750. -
  1751.  
  1752. Interrupts
  1753.  
  1754. Interrupts are disabled
  1755.  
  1756. Processor mode
  1757.  
  1758. Processor is in SVC mode
  1759.  
  1760. Re-entrancy
  1761.  
  1762. Routine is not re-entrant
  1763.  
  1764. Use
  1765.  
  1766. This SWI starts KaData's metronomic timer. If it is already in use, the usage count is incremented.
  1767.  
  1768. If the ticker is not in use at the time of this call, the increment quantum is set to 1000, which gives a millisecond timer.
  1769.  
  1770. Timer 1 can be more reliable than Timer 0, even with a high quantum. A low quantum is more accurate because a lost tick has less effect, and even a high quantum can be less susceptible to drift on some machines (like Kasoft Central). 
  1771.  
  1772. Starting the metronomic timer will cause any previous claimants of the Timer 1 interrupt to stop being called, so beware.
  1773.  
  1774. Related SWIs
  1775.  
  1776. KaData_MetronomicTimerOff (SWI &482D3),
  1777. KaData_MetronomicTimerSmash (SWI &482D4),
  1778. KaData_ReadMetronomicTimer (SWI &482D5),
  1779. KaData_SetMetronomicTimerQuantum (SWI &482DE)
  1780.  
  1781. Related vectors
  1782.  
  1783. None
  1784.  
  1785.  
  1786. KaData_MetronomicTimerOff
  1787. (SWI &482D3)
  1788.     Finish using the timer based on IOC Timer 1
  1789.  
  1790. On entry
  1791.  
  1792. -
  1793.  
  1794. On exit
  1795.  
  1796. -
  1797.  
  1798. Interrupts
  1799.  
  1800. Interrupts are disabled
  1801.  
  1802. Processor mode
  1803.  
  1804. Processor is in SVC mode
  1805.  
  1806. Re-entrancy
  1807.  
  1808. Routine is not re-entrant
  1809.  
  1810. Use
  1811.  
  1812. This SWI should be called to finish using KaData's metronomic timer. If it is in use by another program, the usage count is decremented. Otherwise, the Timer 1 interrupt will be disabled and the metronomic timer will stop.
  1813.  
  1814. Related SWIs
  1815.  
  1816. KaData_MetronomicTimerOn (SWI &482D2),
  1817. KaData_MetronomicTimerSmash (SWI &482D4),
  1818. KaData_ReadMetronomicTimer (SWI &482D5),
  1819. KaData_SetMetronomicTimerQuantum (SWI &482DE)
  1820.  
  1821. Related vectors
  1822.  
  1823. None
  1824.  
  1825.  
  1826. KaData_MetronomicTimerSmash
  1827. (SWI &482D4)
  1828.     Kill the timer based on IOC Timer 1
  1829.  
  1830. On entry
  1831.  
  1832. -
  1833.  
  1834. On exit
  1835.  
  1836. -
  1837.  
  1838. Interrupts
  1839.  
  1840. Interrupts are disabled
  1841.  
  1842. Processor mode
  1843.  
  1844. Processor is in SVC mode
  1845.  
  1846. Re-entrancy
  1847.  
  1848. Routine is not re-entrant
  1849.  
  1850. Use
  1851.  
  1852. This SWI can be called to reset the usage count on the KaData metronomic timer to zero, disabling the Timer 1 interrupt and stopping the metronomic timer. For use in emergencies only, as some programs may be relying on the timer.
  1853.  
  1854. Related SWIs
  1855.  
  1856. KaData_MetronomicTimerOn (SWI &482D2),
  1857. KaData_MetronomicTimerOff (SWI &482D3),
  1858. KaData_ReadMetronomicTimer (SWI &482D5),
  1859. KaData_SetMetronomicTimerQuantum (SWI &482DE)
  1860.  
  1861. Related vectors
  1862.  
  1863. None
  1864.  
  1865.  
  1866. KaData_ReadMetronomicTimer
  1867. (SWI &482D5)
  1868.     Read the timer based on IOC Timer 1
  1869.  
  1870. On entry
  1871.  
  1872. -
  1873.  
  1874. On exit
  1875.  
  1876. R0 = low 32-bits of timer
  1877. R1 = high 32-bits of timer
  1878.  
  1879. Interrupts
  1880.  
  1881. Interrupts are disabled
  1882.  
  1883. Processor mode
  1884.  
  1885. Processor is in SVC mode
  1886.  
  1887. Re-entrancy
  1888.  
  1889. Routine is re-entrant
  1890.  
  1891. Use
  1892.  
  1893. This SWI should be called to read the value of KaData's metronomic timer.
  1894.  
  1895. The timer is a 64-bit value which is the number of microseconds (1 x 10 ^ -6 s) the timer has been running since the KaData module was last initialized. The accuracy is affected by the quantum currently set by KaData_SetMetronomicTimerQuantum (SWI &482DE).
  1896.  
  1897. Wraparound will no longer occur in normal use, and it is no longer necessary to deal with this contingency.
  1898.  
  1899. Related SWIs
  1900.  
  1901. KaData_MetronomicTimerOn (SWI &482D2),
  1902. KaData_MetronomicTimerOff (SWI &482D3),
  1903. KaData_MetronomicTimerSmash (SWI &482D4),
  1904. KaData_SetMetronomicTimerQuantum (SWI &482DE)
  1905.  
  1906. Related vectors
  1907.  
  1908. None
  1909.  
  1910.  
  1911. KaData_PokeDynamicArea
  1912. (SWI &482D6)
  1913.     Changes the maximum size of a dynamic area (not implemented in 0.51)
  1914.  
  1915. On entry
  1916.  
  1917. R1 = area number
  1918. R5 = new maximum size for area, in bytes
  1919.  
  1920. On exit
  1921.  
  1922. R1,R5 preserved
  1923.  
  1924. Interrupts
  1925.  
  1926. Interrupt status is undefined
  1927. Fast interrupts are enabled
  1928.  
  1929. Processor mode
  1930.  
  1931. Processor is in SVC mode
  1932.  
  1933. Re-entrancy
  1934.  
  1935. Not defined
  1936.  
  1937. Use
  1938.  
  1939. This call is for RISC OS 3.50 and above only.
  1940.  
  1941. This SWI will reprogram the maximum size of an existing dynamic area. Do not attempt to set a maximum which causes the area, at its current position, to overlap another. Do not attempt to set a maximum which exceeds the total available memory on the system. Do not set a maximum which is below the current size of the area.
  1942.  
  1943.  
  1944. KaData_ObmatOp
  1945. (SWI &482D7)
  1946.     Perform an operation on an object matrix, or Obmat for short
  1947.     (not implemented in 0.51)
  1948.  
  1949. On entry
  1950.  
  1951. R0 = reason code
  1952. other registers are parameters and depend upon the reason code
  1953.  
  1954. On exit
  1955.  
  1956. R0 preserved
  1957. other registers depend on the reason code
  1958.  
  1959. Interrupts
  1960.  
  1961. Interrupt status is undefined
  1962. Fast interrupts are enabled
  1963.  
  1964. Processor mode
  1965.  
  1966. Processor is in SVC mode
  1967.  
  1968. Re-entrancy
  1969.  
  1970. Not defined
  1971.  
  1972. Use
  1973.  
  1974. This SWI provides a number of calls to manipulate Obmats.
  1975.  
  1976. R0    Action
  1977. 0    Verify file integrity
  1978.  
  1979. Related SWIs
  1980.  
  1981. None
  1982.  
  1983. Related vectors
  1984.  
  1985. None
  1986.  
  1987.  
  1988. KaData_MatchWild
  1989. (SWI &482D8)
  1990.     Compares a wildcarded string against another string
  1991.  
  1992. On entry
  1993.  
  1994. R0 = pointer to first (wildcarded) string (usu. null terminated)
  1995. R1 = pointer to second (unwildcarded) string (null terminated)
  1996. R2 = single (one) character wildcard
  1997. R3 = multiple (zero or more) character wildcard
  1998. R4 = alternative terminator character (e.g. '.' for a pathname element)
  1999. R5 = flags or pointer to lower case table (R5 > 3)
  2000.     Bit    Meaning
  2001.     0    Ignore case
  2002.     1    Ignore accents
  2003.     2-31    Reserved (must be 0)
  2004. R6 = when R5 > 3, pointer to plain table (or 0 if not used)
  2005.  
  2006. On exit
  2007.  
  2008. R0-R6 preserved
  2009. Z set if strings match
  2010.  
  2011. Interrupts
  2012.  
  2013. Interrupt status is undefined
  2014. Fast interrupts are enabled
  2015.  
  2016. Processor mode
  2017.  
  2018. Processor is in SVC mode
  2019.  
  2020. Re-entrancy
  2021.  
  2022. Routine is re-entrant
  2023.  
  2024. Use
  2025.  
  2026. This SWI uses the wildcards given in the first string together with character mappings defined by the current territory to determine if the second string matches. It is particularly useful for filing systems.
  2027.  
  2028. If the TerritoryManager module is not present, you must provide the 256 byte character translation tables yourself by setting R5 and R6 to point to the required tables. R6 may be 0 if only one mapping is needed.
  2029.  
  2030.  
  2031. KaData_CopyString
  2032. (SWI &482D9)
  2033.     Copies a control-terminated string into a buffer
  2034.  
  2035. On entry
  2036.  
  2037. R0 = pointer to source string (usu. control terminated)
  2038. R1 = pointer to buffer to hold copied string
  2039. R2 = alternative terminator character
  2040.  
  2041. On exit
  2042.  
  2043. -
  2044.  
  2045. Interrupts
  2046.  
  2047. Interrupt status is undefined
  2048. Fast interrupts are enabled
  2049.  
  2050. Processor mode
  2051.  
  2052. Processor is in SVC mode
  2053.  
  2054. Re-entrancy
  2055.  
  2056. Routine is re-entrant
  2057.  
  2058. Use
  2059.  
  2060. Copies a control character (ASCII 0-31) terminated string into the specified buffer, replacing the terminator with a null. This call should only be made for strings whose maximum possible length is known, so that the buffer can be made big enough. An alternative terminator may be given- this will be replaced by a null character in the resulting buffer.
  2061.  
  2062. Related SWIs
  2063.  
  2064. None
  2065.  
  2066. Related vectors
  2067.  
  2068. None
  2069.  
  2070.  
  2071. KaData_Heap
  2072. (SWI &482DA)
  2073.     Support for shifting heaps (not implemented in 0.51)
  2074.  
  2075. On entry
  2076.  
  2077. R0 = reason code
  2078. other registers are parameters and depend upon the reason code
  2079.  
  2080. On exit
  2081.  
  2082. R0 preserved
  2083. other registers depend on the reason code
  2084.  
  2085. Interrupts
  2086.  
  2087. Interrupt status is undefined
  2088. Fast interrupts are enabled
  2089.  
  2090. Processor mode
  2091.  
  2092. Processor is in SVC mode
  2093.  
  2094. Re-entrancy
  2095.  
  2096. Not defined
  2097.  
  2098. Use
  2099.  
  2100. This SWI provides a number of calls which provide support for shifting heaps.
  2101.  
  2102. R0    Action
  2103. 0    Initialize heap
  2104. 1    New dynamic area based heap (RISC OS 3.50 and above only)
  2105. 2    Remove dynamic area based heap (RISC OS 3.50 and above only)
  2106. 3    New shifting block
  2107. 4    New static block
  2108. 5    Get block details
  2109. 6    Change block details
  2110. 7    Remove block
  2111. 8    Remove all blocks with ID given
  2112. 9    Change details of all blocks with ID given
  2113. 10    Resize block
  2114. 11    Extend block given offset
  2115. 12    New anchor
  2116. 13    Remove anchor
  2117. 14    Reduce size of heap
  2118. 15    Fully compact heap
  2119. 16    Get heap details
  2120. 17    Change heap details
  2121. 18    New relocation stack
  2122. 19    Get relocation stack details
  2123. 20    Change relocation stack details
  2124. 21    Push onto relocation stack
  2125. 22    Pull off relocation stack
  2126. 23    Remove relocation stack
  2127. 24    Enumerate blocks
  2128.  
  2129. Related SWIs
  2130.  
  2131. OS_Heap (SWI &1D)
  2132.  
  2133. Related vectors
  2134.  
  2135. None
  2136.  
  2137.  
  2138. KaData_Module
  2139. (SWI &482DB)
  2140.     Support for KaData resource module files
  2141.  
  2142. On entry
  2143.  
  2144. R0 = reason code
  2145. other registers are parameters and depend upon the reason code
  2146.  
  2147. On exit
  2148.  
  2149. R0 preserved
  2150. other registers depend on the reason code
  2151.  
  2152. Interrupts
  2153.  
  2154. Interrupt status is undefined
  2155. Fast interrupts are enabled
  2156.  
  2157. Processor mode
  2158.  
  2159. Processor is in SVC mode
  2160.  
  2161. Re-entrancy
  2162.  
  2163. Not defined
  2164.  
  2165. Use
  2166.  
  2167. This SWI provides a number of calls to deal with KaData resource module files. These files have type KaDatMod (&3E5).
  2168.  
  2169. R0    Action
  2170. 0    Build menu tree from ROMD (RISC OS Menu Data) file
  2171. 1    Build menu from KDOS (KaData Ordinal String) file
  2172.  
  2173. This call reads the file sequentially, which means that it can be used to read a resource module file from a filing system like Acorn PipeFS.
  2174.  
  2175. Related SWIs
  2176.  
  2177. None
  2178.  
  2179. Related vectors
  2180.  
  2181. None
  2182.  
  2183.  
  2184. KaData_Module 0
  2185. (SWI &482DB)
  2186.     Build menu tree from ROMD (RISC OS Menu Data) file
  2187.  
  2188. On entry
  2189.  
  2190. R0 = 0
  2191. R1 = pointer to filename
  2192. R2 = pointer to block to store data (-1 to allocate a block from the RMA)
  2193.  
  2194. On exit
  2195.  
  2196. R0,R1 preserved
  2197. R2 = pointer to menu block
  2198.  
  2199. Interrupts
  2200.  
  2201. Interrupt status is undefined
  2202. Fast interrupts are enabled
  2203.  
  2204. Processor mode
  2205.  
  2206. Processor is in SVC mode
  2207.  
  2208. Re-entrancy
  2209.  
  2210. Not defined
  2211.  
  2212. Use
  2213.  
  2214. Takes a menu data file, consisting of a menu block where all addresses are offsets within the file (excluding the four byte header, so that offset 0 is actually offset 4), and builds a menu block that may be passed to Wimp_CreateMenu (SWI &400D4). Further menu blocks may also be incorporated to define submenus. The word after the last menu block should be set to -1. Indirected icon data should follow the last menu block.
  2215.  
  2216. A menu data file may be conveniently created by an assembler.
  2217.  
  2218. This call reads the file sequentially, which means that it can be used to read a resource module file from a filing system like Acorn PipeFS.
  2219.  
  2220.  
  2221. KaData_Module 1
  2222. (SWI &482DB)
  2223.     Build menu from KDOS (KaData Ordinal String) file
  2224.  
  2225. On entry
  2226.  
  2227. R0 = 1
  2228. R1 = pointer to filename
  2229. R2 = pointer to block to store menu (-1 to allocate a block from the RMA)
  2230. R3 = pointer to block to store indirected icons (-1 to allocate a block)
  2231. R4 = menu item flags
  2232. R5 = submenu pointer (-1 for leaf items)
  2233.  
  2234. On exit
  2235.  
  2236. R0,R1 preserved
  2237. R2 = pointer to menu block
  2238. R3 = pointer to indirected icon block
  2239. R4,R5 preserved
  2240.  
  2241. Interrupts
  2242.  
  2243. Interrupt status is undefined
  2244. Fast interrupts are enabled
  2245.  
  2246. Processor mode
  2247.  
  2248. Processor is in SVC mode
  2249.  
  2250. Re-entrancy
  2251.  
  2252. Not defined
  2253.  
  2254. Use
  2255.  
  2256. Takes a KaData Ordinal String file, and builds a menu from it, which may be passed to Wimp_CreateMenu (SWI &400D4).
  2257.  
  2258. This call reads the file sequentially, which means that it can be used to read a resource module file from a filing system like Acorn PipeFS. This feature is used by the AddressDevice DA Filer to build a menu from the spooled output of *Discs.
  2259.  
  2260.  
  2261. KaData_GetString
  2262. (SWI &482DC)
  2263.     Reads a string of characters from a file
  2264.  
  2265. On entry
  2266.  
  2267. R0 = preferred terminator character and flags
  2268. R1 = file handle
  2269. R2 = buffer for string
  2270. R3 = buffer size
  2271. R4 = sequential pointer (ignored when not required by flags)
  2272.  
  2273. On exit
  2274.  
  2275. R0 = terminator character encountered in file
  2276. R1 preserved
  2277. R2 = pointer to terminator character in buffer
  2278. R3 = space remaining in buffer
  2279. R4 = new sequential pointer (preserved when not required by flags)
  2280.  
  2281. Interrupts
  2282.  
  2283. Interrupt status is undefined
  2284. Fast interrupts are enabled
  2285.  
  2286. Processor mode
  2287.  
  2288. Processor is in SVC mode
  2289.  
  2290. Re-entrancy
  2291.  
  2292. Routine is re-entrant
  2293.  
  2294. Use
  2295.  
  2296. Reads an arbitarily terminated string from a file, using register bindings similar to OS_GBPB.
  2297.  
  2298. R4 specifies how the string is read, as follows:
  2299.  
  2300. Bits    Meaning
  2301. 0-7    Terminator character
  2302. 8    Set if string can be terminated by any control character
  2303. 9    Set to read from current sequential pointer (don't use R4 on entry)
  2304. 10    Set to find new sequential pointer (use R4 on exit when bit 9 set)
  2305.  
  2306. Note that bit 10 only applies if bit 9 is set. That is, a read from a designated pointer (bit 9 unset) will always return an updated pointer in R4 on exit, but a read from the current sequential pointer (bit 9 set) will only use R4 on exit if bit 10 is set.
  2307.  
  2308. Related SWIs
  2309.  
  2310. OS_BGet (SWI &0A), OS_GBPB (SWI &0C), KaData_PutString (SWI &482DD)
  2311.  
  2312. Related vectors
  2313.  
  2314. BGetV
  2315.  
  2316.  
  2317. KaData_PutString
  2318. (SWI &482DD)
  2319.     Writes a string of characters to a file
  2320.  
  2321. On entry
  2322.  
  2323. R0 = replacement terminator character and flags
  2324. R1 = file handle
  2325. R2 = pointer to string
  2326. R4 = sequential pointer (ignored when not required by flags)
  2327.  
  2328. On exit
  2329.  
  2330. R0 = terminator character written to file
  2331. R1 preserved
  2332. R2 = pointer to terminator character in buffer
  2333. R3 = number of bytes written to file
  2334. R4 = new sequential pointer (preserved when not required by flags)
  2335.  
  2336. Interrupts
  2337.  
  2338. Interrupt status is undefined
  2339. Fast interrupts are enabled
  2340.  
  2341. Processor mode
  2342.  
  2343. Processor is in SVC mode
  2344.  
  2345. Re-entrancy
  2346.  
  2347. Routine is re-entrant
  2348.  
  2349. Use
  2350.  
  2351. Reads a pre-terminated or control character terminated string from a buffer, and places it in a file with the specified terminator, using register bindings similar to OS_GBPB.
  2352.  
  2353. R4 specifies how the string is written, as follows:
  2354.  
  2355. Bits    Meaning
  2356. 0-7    Terminator character (will replace control character if bit 8 set)
  2357. 8    Set if buffered string can be terminated by any control character
  2358. 9    Set to write to current sequential pointer (don't use R4 on entry)
  2359. 10    Set to find new sequential pointer (use R4 on exit when bit 9 set)
  2360.  
  2361. Note that bit 10 only applies if bit 9 is set. That is, a write to a designated pointer (bit 9 unset) will always return an updated pointer in R4 on exit, but a write to the current sequential pointer (bit 9 set) will only use R4 on exit if bit 10 is set.
  2362.  
  2363. Related SWIs
  2364.  
  2365. OS_BPut (SWI &0B), OS_GBPB (SWI &0C), KaData_GetString (SWI &482DC)
  2366.  
  2367. Related vectors
  2368.  
  2369. BPutV
  2370.  
  2371.  
  2372. KaData_SetMetronomicTimerQuantum
  2373. (SWI &482DE)
  2374.     Set the quantum used by the timer based on IOC Timer 1
  2375.  
  2376. On entry
  2377.  
  2378. R0 = new quantum (or 0 to read)
  2379. R1 = 0 to write, -1 to read
  2380.  
  2381. On exit
  2382.  
  2383. R0 = old quantum
  2384. R1 preserved
  2385.  
  2386. Interrupts
  2387.  
  2388. Interrupts are disabled
  2389.  
  2390. Processor mode
  2391.  
  2392. Processor is in SVC mode
  2393.  
  2394. Re-entrancy
  2395.  
  2396. Routine is not re-entrant
  2397.  
  2398. Use
  2399.  
  2400. This SWI will set the increment quantum of KaData's metronomic timer.
  2401.  
  2402. Valid quantum values are:
  2403.  
  2404. 1    Timer is updated at 1 MHz (will stall some machines)
  2405. 10    Timer is updated at 100 kHz (will severely slow machines)
  2406. 100    Timer is updated at 10 kHz
  2407. 1000    Timer is updated at 1 kHz (default)
  2408. 10000    Timer is updated at 100 Hz
  2409.  
  2410. You should always check the quantum value before changing it. Normally it is acceptable to reduce the quantum, but increasing the quantum should be avoided unless you are sure that you are the only client of the timer.
  2411.  
  2412. Related SWIs
  2413.  
  2414. KaData_MetronomicTimerOn (SWI &482D2),
  2415. KaData_MetronomicTimerOff (SWI &482D3),
  2416. KaData_MetronomicTimerSmash (SWI &482D4),
  2417. KaData_SetMetronomicTimerQuantum (SWI &482DE)
  2418.  
  2419. Related vectors
  2420.  
  2421. None
  2422.